import { createApp } from 'vue'
import App from '@/App.vue'

//引入element-plus插件与样式
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import zhCn from 'element-plus/es/locale/lang/zh-cn'

//svg插件需要的配置代码
//@ts-ignore
import 'virtual:svg-icons-register'
// 注册全局组件
// import SvgIcon from '@/components/SvgIcon/index.vue'
// app.component('SvgIcon', SvgIcon)

//引入自定义插件对象：注册整个项目全局组件
import globalComponent from './components'
//引入模板的全局样式文件
import '@/styles/index.scss'
//引入暗黑模式所需的样式文件
import 'element-plus/theme-chalk/dark/css-vars.css'

import router from './router'
import pinia from './store'

const app = createApp(App)

app.use(ElementPlus, {
  locale: zhCn, //element-plus国际化配置
})

//安装自定义插件
app.use(globalComponent)
//安装仓库
app.use(pinia)
app.use(router)

//测试代码
// const response = axios({
//   url: '/api/user/login',
//   method: 'post',
//   data: {
//     username: 'admin',
//     password: '123456',
//   },
// })
//@ts-ignore
import './permission'
import { isHasButton } from './directive/has'

isHasButton(app)

app.mount('#app')
